package Demo;

public class Test {
    public static int func(){
        try {
            int[] arr=null;
            int r=arr.length;
            return 10;
        }catch (NullPointerException e){
            System.out.println("yichang");
        }finally {
            return 20;
        }
    }
    public static void main1(String[] args) {
        int ret=func();
        System.out.println(ret);
    }
    public static void main(String[] args) {
        int[] arr={1,2,3};
        try {
            arr[10]=10;
            arr=null;
            System.out.println(arr.length);
            System.out.println("try执行");
        }catch (IndexOutOfBoundsException e){
            System.out.println("catch执行了");
            System.out.println("捕获");
        }catch (Exception e){
            System.out.println("E异常");
        }
        finally {
            System.out.println("finally执行了");
        }
        System.out.println("......");


    }
}
